/**
 * 
 */
package com.bolbachchan.blog.service.security;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bolbachchan.blog.dao.security.LdapSecurityDAO;

/**
 * @author Chaitanya
 * 
 */
@Service
public class LoginSecurityServiceImpl implements LoginSecurityService {

	@Autowired
	private LdapSecurityDAO securityDao;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.bolbachchan.blog.service.security.LoginSecurityService#findUsername
	 * (java.lang.String)
	 */
	@Override
	public String findUsername(String username) {
		List<String> usernames = securityDao.findUsername(username);
		if (usernames == null || usernames.isEmpty()) {
			return null;
		} else {
			return usernames.get(0);
		}
	}

}
